package com.neudu.glsb.pojo;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable;
import java.math.BigDecimal;
import lombok.Data;

/**
 * 系统基础配置信息
 * @TableName system_config
 */
@TableName(value ="system_config")
@Data
public class SystemConfig implements Serializable {
    /**
     *
     */
    @TableId(type = IdType.AUTO)
    private Integer id;

    /**
     * 店主信息及联系方式
     */
    private String ownerInfo;

    private String paymentCodeUrl; // 新增属性对应新字段
    /**
     * 收款码设置，修改为 byte[] 类型以存储图片字节数组
     */
    private byte[] paymentCode;

    /**
     * 系统存储路径设置
     */
    private String storagePath;

    /**
     * 邮箱服务器
     */
    private String emailServer;

    /**
     * 邮箱用户名
     */
    private String emailUsername;

    /**
     * 邮箱密码
     */
    private String emailPassword;

    /**
     * 配送方式
     */
    private String deliveryMethod;

    /**
     * 配送收费
     */
    private BigDecimal deliveryFee;

    /**
     * 第三方配送基础信息
     */
    private String thirdPartyDeliveryInfo;

    @TableField(exist = false)
    private static final long serialVersionUID = 1L;

    @Override
    public boolean equals(Object that) {
        if (this == that) {
            return true;
        }
        if (that == null) {
            return false;
        }
        if (getClass() != that.getClass()) {
            return false;
        }
        SystemConfig other = (SystemConfig) that;
        return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
                && (this.getOwnerInfo() == null ? other.getOwnerInfo() == null : this.getOwnerInfo().equals(other.getOwnerInfo()))
                && (this.getPaymentCode() == null ? other.getPaymentCode() == null : java.util.Arrays.equals(this.getPaymentCode(), other.getPaymentCode()))
                && (this.getStoragePath() == null ? other.getStoragePath() == null : this.getStoragePath().equals(other.getStoragePath()))
                && (this.getEmailServer() == null ? other.getEmailServer() == null : this.getEmailServer().equals(other.getEmailServer()))
                && (this.getEmailUsername() == null ? other.getEmailUsername() == null : this.getEmailUsername().equals(other.getEmailUsername()))
                && (this.getEmailPassword() == null ? other.getEmailPassword() == null : this.getEmailPassword().equals(other.getEmailPassword()))
                && (this.getDeliveryMethod() == null ? other.getDeliveryMethod() == null : this.getDeliveryMethod().equals(other.getDeliveryMethod()))
                && (this.getDeliveryFee() == null ? other.getDeliveryFee() == null : this.getDeliveryFee().equals(other.getDeliveryFee()))
                && (this.getThirdPartyDeliveryInfo() == null ? other.getThirdPartyDeliveryInfo() == null : this.getThirdPartyDeliveryInfo().equals(other.getThirdPartyDeliveryInfo()));
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
        result = prime * result + ((getOwnerInfo() == null) ? 0 : getOwnerInfo().hashCode());
        result = prime * result + ((getPaymentCode() == null) ? 0 : java.util.Arrays.hashCode(getPaymentCode()));
        result = prime * result + ((getStoragePath() == null) ? 0 : getStoragePath().hashCode());
        result = prime * result + ((getEmailServer() == null) ? 0 : getEmailServer().hashCode());
        result = prime * result + ((getEmailUsername() == null) ? 0 : getEmailUsername().hashCode());
        result = prime * result + ((getEmailPassword() == null) ? 0 : getEmailPassword().hashCode());
        result = prime * result + ((getDeliveryMethod() == null) ? 0 : getDeliveryMethod().hashCode());
        result = prime * result + ((getDeliveryFee() == null) ? 0 : getDeliveryFee().hashCode());
        result = prime * result + ((getThirdPartyDeliveryInfo() == null) ? 0 : getThirdPartyDeliveryInfo().hashCode());
        return result;
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append(getClass().getSimpleName());
        sb.append(" [");
        sb.append("Hash = ").append(hashCode());
        sb.append(", id=").append(id);
        sb.append(", ownerInfo=").append(ownerInfo);
        sb.append(", paymentCode=").append(paymentCode == null? null : new String(paymentCode)); // 这里为了简单显示，将 byte[] 转为 String，实际可能需要更合适的处理方式
        sb.append(", storagePath=").append(storagePath);
        sb.append(", emailServer=").append(emailServer);
        sb.append(", emailUsername=").append(emailUsername);
        sb.append(", emailPassword=").append(emailPassword);
        sb.append(", deliveryMethod=").append(deliveryMethod);
        sb.append(", deliveryFee=").append(deliveryFee);
        sb.append(", thirdPartyDeliveryInfo=").append(thirdPartyDeliveryInfo);
        sb.append(", serialVersionUID=").append(serialVersionUID);
        sb.append("]");
        return sb.toString();
    }
}